package smetana.modules.ui.form.search;

import org.apache.pivot.wtk.Dialog;
import smetana.modules.ui.form.AbstractDialog;
import smetana.modules.ui.form.window.ShowExceptionPanel;

/**
 * @author dmitry.mamonov
 */
public class ShowExceptionDialog extends AbstractDialog {
    Dialog dialog;
    ShowExceptionPanel showExceptionPanel = new ShowExceptionPanel(){
        @Override
        protected void close() {
            getDialog().close();
        }
    };

    public void setThrowable(Throwable th) {
        showExceptionPanel.setThrowable(th);
    }

    @Override
    public Dialog getDialog() {
        if (dialog==null){
            dialog = new Dialog("Ошибка", showExceptionPanel.getComponent());
        }
        return dialog;
    }
}
